﻿#ifndef SERIALCONTROLLER_H
#define SERIALCONTROLLER_H

#include <QObject>
#include <QtSerialPort/QSerialPort>
#include <QEventLoop>
#include <QTimer>
#include <QQueue>
#include <QMutex>
//#include "Logger.h"
//#include "DeviceParamsConfig.h"
class SerialController : public QObject
{
    Q_OBJECT
public:
    bool isBreak = false;
    quint8 targetStageNo = 0;

    explicit SerialController(QObject *parent = nullptr);
    ~SerialController();
    bool SerialInit(QString com,int band,int dataBits,int stopBits,int parity);
    bool serialController_init();
    QByteArray sendAsync(QByteArray data);
    bool CRC_16(QByteArray &arr);
private:

public:

signals:

private:
    QSerialPort *pPortUart = nullptr;
    QMutex mutex;


    int falsecnt = 0;
    bool isconnected = false;

};

#endif // SERIALCONTROLLER_H
